Skip to content

Conversation

@pablo-cort-s73
Copy link

The main changes include:

  • Updating links, versions, and references in the documentation and description files to point to version 19.0.
  • Modifications to the Python code to use odoo.fields. Domain in the construction of domains and risk field lists, adapting the logic to the new Odoo 19.0 API.
  • Adjustment to the signature of the _set_authorized method to accept additional arguments (**kwargs).

@pablo-cort-s73 pablo-cort-s73 force-pushed the 19.0-mig-sale_financial_risk branch from 29a9bba to b4b502b Compare November 13, 2025 16:59
@pablo-cort-s73 pablo-cort-s73 changed the title [19.0][MIG] account_financial_risk: Migration to 19.0 [19.0][MIG] sale_financial_risk: Migration to 19.0 Nov 14, 2025
@pedrobaeza
Copy link
Member

/ocabot migration sale_financial_risk

@OCA-git-bot OCA-git-bot added this to the 19.0 milestone Nov 14, 2025
@OCA-git-bot OCA-git-bot mentioned this pull request Nov 14, 2025
13 tasks
@pablo-cort-s73 pablo-cort-s73 force-pushed the 19.0-mig-sale_financial_risk branch 5 times, most recently from ebba929 to 939adc7 Compare November 18, 2025 09:48
carlosdauden and others added 20 commits November 18, 2025 10:49
Currently translated at 7.7% (1 of 13 strings)

Translation: credit-control-12.0/credit-control-12.0-sale_financial_risk
Translate-URL: https://translation.odoo-community.org/projects/credit-control-12-0/credit-control-12-0-sale_financial_risk/fr/
Currently translated at 7.7% (1 of 13 strings)

Translation: credit-control-12.0/credit-control-12.0-sale_financial_risk
Translate-URL: https://translation.odoo-community.org/projects/credit-control-12-0/credit-control-12-0-sale_financial_risk/pt_BR/
Currently translated at 46.2% (6 of 13 strings)

Translation: credit-control-12.0/credit-control-12.0-sale_financial_risk
Translate-URL: https://translation.odoo-community.org/projects/credit-control-12-0/credit-control-12-0-sale_financial_risk/it/
Currently translated at 100.0% (13 of 13 strings)

Translation: credit-control-12.0/credit-control-12.0-sale_financial_risk
Translate-URL: https://translation.odoo-community.org/projects/credit-control-12-0/credit-control-12-0-sale_financial_risk/pt_BR/
Currently translated at 23.1% (3 of 13 strings)

Translation: credit-control-12.0/credit-control-12.0-sale_financial_risk
Translate-URL: https://translation.odoo-community.org/projects/credit-control-12-0/credit-control-12-0-sale_financial_risk/pt/
…le_financial_risk:

 - Optimize code and change stored computed fields to not store to improve multi-company support
 - Improve multi-currency support
 - Convert risk amount fields to clickable link that shows traceability of amount origin
 - New pivot views to risk amount traceability
 - Simplify class style applied on risk fields
 - Migration script to remove old stored computed fields
 - Improve tests to cover new functionallity
 - Update translation files

account_financial_risk:
 - Don't block refund invoice validation when partner has risk exception
 - Allow search partners by risk exception field
 - Remove obsolete cron

sale_financial_risk
 - Create related store commercial_partner_id field in sale order line to simplify computation
 - Rename amt_to_invoice field to risk_amount in sale order line
 - Hook and migration scripts to reduce new fields computing time

TT23765
jesusVMayor and others added 27 commits November 18, 2025 10:49
Currently translated at 85.0% (17 of 20 strings)

Translation: credit-control-15.0/credit-control-15.0-sale_financial_risk
Translate-URL: https://translation.odoo-community.org/projects/credit-control-15-0/credit-control-15-0-sale_financial_risk/fr/
Currently translated at 25.0% (5 of 20 strings)

Translation: credit-control-15.0/credit-control-15.0-sale_financial_risk
Translate-URL: https://translation.odoo-community.org/projects/credit-control-15-0/credit-control-15-0-sale_financial_risk/it/
Currently translated at 100.0% (20 of 20 strings)

Translation: credit-control-16.0/credit-control-16.0-sale_financial_risk
Translate-URL: https://translation.odoo-community.org/projects/credit-control-16-0/credit-control-16-0-sale_financial_risk/es/
res.partner credit_limit field is a commercial field that triggers the
children syncronization. In partners with lots of children, those
recalculations can lead to a poor user experience when a operation that
is replicated over all the children doesn't perform fine. This is the
case with the risk_partner_id field, wich relation is recalculated a
thus as many queries as children has the contact (it can be dozens).

TT43572
Currently translated at 100.0% (21 of 21 strings)

Translation: credit-control-16.0/credit-control-16.0-sale_financial_risk
Translate-URL: https://translation.odoo-community.org/projects/credit-control-16-0/credit-control-16-0-sale_financial_risk/es/
- Include context keys for avoiding mail operations overhead.
Currently translated at 100.0% (21 of 21 strings)

Translation: credit-control-16.0/credit-control-16.0-sale_financial_risk
Translate-URL: https://translation.odoo-community.org/projects/credit-control-16-0/credit-control-16-0-sale_financial_risk/es/
This issue appeared for multi-company, multi-currency configuration. Whenever risk was calculated for the partner, Sale Order amount was converted to company currency, instead of currency set on the partner.

This commit fixes the issue by converting to correct currency (set on the partner).
The test_manual_currency_risk_not_exceeded test that assesses that the
manual currency risk has not been passed fails when another module changes
the company's currency. The reason for the failure is that if the company
currency matches the currency of the sell order it does not convert
correctly and in that case it interprets the limit within the same currency.
For example, if the company currency is set as EUR and the sales order
is placed in EUR, the conversion of the 100€ is not done and therefore
exceeds the limit set to 99. To solve this, the company currency is
first checked to set a different currency in the order. On the other
hand, the tests should be frozen at a certain date to prevent the
exchange rate of the exchange currency from going up or down thus
avoiding errors when running the test, which should check that it has
not been exceeded.
Currently translated at 100.0% (21 of 21 strings)

Translation: credit-control-16.0/credit-control-16.0-sale_financial_risk
Translate-URL: https://translation.odoo-community.org/projects/credit-control-16-0/credit-control-16-0-sale_financial_risk/nl/
Currently translated at 100.0% (21 of 21 strings)

Translation: credit-control-17.0/credit-control-17.0-sale_financial_risk
Translate-URL: https://translation.odoo-community.org/projects/credit-control-17-0/credit-control-17-0-sale_financial_risk/it/
…ax amounts.

The product product.product_product_2 does not have explicit taxes, but after this commit
odoo/odoo@2836416, an error occurs when comparing the expected amount. So, adapt the amount to compare without taxes and create a new product to avoid depending on demo data.
Currently translated at 100.0% (21 of 21 strings)

Translation: credit-control-18.0/credit-control-18.0-sale_financial_risk
Translate-URL: https://translation.odoo-community.org/projects/credit-control-18-0/credit-control-18-0-sale_financial_risk/tr/
…id errors in tests

Use the same method that appears in sale test: https://github.com/odoo/odoo/blob/74eecadb39e0c260f4cfc1ae9478c84eda815132/addons/sale/tests/test_payment_flow.py#L43

Traceback (most recent call last):
  File "/opt/odoo/auto/addons/sale_financial_risk/tests/test_payment_financial_risk.py", line 70, in test_payment_risk_bypass
    patched.assert_called_once_with(ANY, sale_order_id=ANY)
  File "/usr/local/lib/python3.10/unittest/mock.py", line 941, in assert_called_once_with
    return self.assert_called_with(*args, **kwargs)
  File "/usr/local/lib/python3.10/unittest/mock.py", line 929, in assert_called_with
    raise AssertionError(_error_message()) from cause
AssertionError: expected call not found.
Expected: _compute_show_tokenize_input_mapping(<ANY>, sale_order_id=<ANY>)
Actual: _compute_show_tokenize_input_mapping(payment.provider(18,), website_id=1, sale_order_id=91)
When users without accounting access are trying to access a Sale Order, they have an access error on the partner field credit_limit (standard Odoo field that is limited to Account groups), which is used when computing the SO's risk_info.

Use sudo across in the financial risk modules when accessing partner.credit_limit.
@pablo-cort-s73 pablo-cort-s73 force-pushed the 19.0-mig-sale_financial_risk branch from 939adc7 to e73e402 Compare November 18, 2025 12:38
@pablo-cort-s73 pablo-cort-s73 force-pushed the 19.0-mig-sale_financial_risk branch from e73e402 to 1d19c31 Compare November 19, 2025 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.